home *** CD-ROM | disk | FTP | other *** search
- /* DateCheck version 1.01 - Check the validity of the system date */
- /* Copyright © Michael Tanzer, 1992 */
- /* See additional notices in accompanying documentation */
-
- datefile = 'S:DateCheck.date' /* Identify file to contain stored date */
- maxdays = 1 /* Maximum days between stored date and system date */
-
- /* Verify option or handle 'help' request */
- arg option
- if words(option)>0 & option~='RESET' then do
- say 'Use DateCheck to check the validity of the system date.'
- say 'Format: DATECHECK <RESET>'
- say 'The ''RESET'' option forces the current system date to'
- say 'be stored in' datefile 'without being checked.'
- exit
- end
-
- /* Make sure the necessary libraries are available */
- if ~show('L','rexxsupport.library') then
- call addlib('rexxsupport.library',0,-30)
- if ~show('L','rexxarplib.library') then
- call addlib('rexxarplib.library',0,-30)
-
- /* Handle RESET option */
- if option='RESET' then do
- thisdate = date('B')
- call write
- exit
- end
-
- /* Compare current system date with stored date */
- call open('input',datefile,'R')
- if ~result then do
- say 'Unable to open' datefile'.'
- exit
- end
- lastdate = readln('input')
- call close 'input'
- thisdate = date('B')
- if datatype(lastdate,'W') then difference = thisdate-lastdate
- else difference = -1
- if difference=0 then exit
- if difference<0 | difference>maxdays then do
- parse value date() with day . year .
- date = strip(day,'L','0') date('M') year
- prompt = 'The system date appears to be' date'.'
- response = request(0,0,prompt,,'No problem!','I had better fix that.')
- if response~='OKAY' then exit
- end
- call write
- exit
-
- /* Store current system date */
- write:
- call open('output',datefile,'W')
- if ~result then do
- say 'Unable to write' datefile'.'
- exit
- end
- call writeln 'output',thisdate
- call close 'output'
- return
-